package com.ruoyi.web.controller.statistic;

import java.util.List;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.order.domain.StatisticGreenhouse;
import com.ruoyi.order.service.IStatisticGreenhouseService;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * VIEWController
 *
 * @author ruoyi
 * @date 2021-07-08
 */
@RestController
@RequestMapping("/system/statisticGreenhouse")
public class StatisticGreenhouseController extends BaseController
{
    @Autowired
    private IStatisticGreenhouseService statisticGreenhouseService;
    @Autowired
    private TokenService tokenService;

    /**
     * 查询片区列表
     */
    @PreAuthorize("@ss.hasPermi('system:greenhouse:list')")
    @GetMapping("/list")
    @ApiOperation("查询片区报表,不需要传参")
    public TableDataInfo list(StatisticGreenhouse statisticGreenhouse)
    {
        startPage();
        List<StatisticGreenhouse> list = statisticGreenhouseService.selectStatisticGreenhouseList(statisticGreenhouse,tokenService.getLoginUser(ServletUtils.getRequest()).getUser());
        return getDataTable(list);
    }

    /**
     * 导出VIEW列表
     */
//    @PreAuthorize("@ss.hasPermi('system:greenhouse:export')")
    @Log(title = "VIEW", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(StatisticGreenhouse statisticGreenhouse)
    {
        List<StatisticGreenhouse> list = statisticGreenhouseService.selectStatisticGreenhouseList(statisticGreenhouse,tokenService.getLoginUser(ServletUtils.getRequest()).getUser());
        ExcelUtil<StatisticGreenhouse> util = new ExcelUtil<StatisticGreenhouse>(StatisticGreenhouse.class);
        return util.exportExcel(list, "VIEW数据");
    }




}
